Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 27, 2025

identified in #4372

------ ------------------------------------------------------------------------------------------------------------------- 
  Line   src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php                                          
 ------ ------------------------------------------------------------------------------------------------------------------- 
  34     Offset string on array<PHPStan\Reflection\ExtendedMethodReflection> in isset() always exists and is not nullable.  
         🪪  isset.offset                                                                                                   
         at src/Reflection/Annotations/AnnotationsMethodsClassReflectionExtension.php:34                                    
 ------ ------------------------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------------------------------- 
  Line   src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php                                         
 ------ --------------------------------------------------------------------------------------------------------------------- 
  28     Offset string on array<PHPStan\Reflection\ExtendedPropertyReflection> in isset() always exists and is not nullable.  
         🪪  isset.offset                                                                                                     
         at src/Reflection/Annotations/AnnotationsPropertiesClassReflectionExtension.php:28                                   
 ------ --------------------------------------------------------------------------------------------------------------------- 

if ($method === null) {
return false;
}
$this->methods[$classReflection->getCacheKey()][$methodName] = $method;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case this property is meant to be a cache, I think we could adjust the above IF case, as it effectively means a non-existant method will be checked for over and over again

@staabm
Copy link
Contributor Author

staabm commented Sep 27, 2025

regression test added in 5374f42

@ondrejmirtes ondrejmirtes merged commit b94e179 into phpstan:2.1.x Sep 27, 2025
545 of 550 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the simpl branch September 27, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants